const router = require('koa-router')()
const ctl = require('../controller/users.js')

router.prefix('/users')

router.get('/', function (ctx, next) {
  ctx.body = 'this is a users response!'
})

router.get('/bar', function (ctx, next) {
  ctx.body = 'this is a users/bar response'
})

router.post('/login',  async (ctx, next)=> {
  await ctl.login(ctx)
})
router.post('/register',  async (ctx, next)=> {
  await ctl.register(ctx)
})
router.post('/verify',  async (ctx, next)=> {
  await ctl.verify(ctx)
})
router.post('/updatePwd',  async (ctx, next)=> {
  await ctl.updatePwd(ctx)
})



router.post('/add',  async (ctx, next)=> {
  await ctl.add(ctx)
})

router.post('/update',  async (ctx, next)=> {
  await ctl.update(ctx)
})

router.post('/del',  async (ctx, next)=> {
  await ctl.del(ctx)
})

router.get('/find',  async (ctx, next)=> {
  await ctl.find(ctx)
})

router.get('/findOne',  async (ctx, next)=> {
  await ctl.findOne(ctx)
})

module.exports = router
